<?php

namespace App\Http\Controllers\Admin\Setting;

use App\Http\Controllers\Controller;
use App\Models\Cities;
use App\Models\MacroManagement;
use Illuminate\Http\Request;

class MacroManagementController extends Controller
{
    protected $suffix = '';
    protected $page_title = '省代';
    protected $page_name = 'distributor';
    protected $view_index = 'admin.template.index';
    protected $view_show = 'admin.template.show';
    protected $view_edit = 'admin.template.edit';
    protected $view_create = 'admin.template.create';

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $page = [
            'page_name' => $this->page_name,
            'title' => $this->page_title . $this->suffix
        ];

        $data = MacroManagement::orderBy('id')->paginate();
        $thead = [
            'macro_name', 'english_value', 'traditional_chiness_value', 'simplified_chiness_value'
        ];
        $tbody = [];
        foreach ($data as $k => $v) {
            $tbody[] = [
                'id' => $v->macro_name,
                'english_value' => $v->english_value,
                'traditional_chiness_value' => $v->traditional_chiness_value,
                'simplified_chiness_value' => $v->simplified_chiness_value,
            ];
        }
        return view($this->view_index, [
            'data'=>$data,
            'page' => $page,
            'thead' => $thead,
            'tbody' => $tbody,
        ]);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}
